#ifndef UI_CALQUE_H
#define UI_CALQUE_H

#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QCheckBox>
#include <QtGui/QGroupBox>
#include <QtGui/QHeaderView>
#include <QtGui/QLCDNumber>
#include <QtGui/QLabel>
#include <QtGui/QMenu>
#include <QtGui/QSlider>
#include <QtGui/QWidget>
#include <QtGui/QGridLayout>
#include <QToolButton>
#include <QSpinBox>
#include <QtGui/QScrollArea>

QT_BEGIN_NAMESPACE

class Ui_Calques
{
public:

    QSpinBox *spinBoxOpacite;
    QSlider *sliderOpacite;
    QLabel *labelCalque;
    QLabel *labelTitreCalque;
    QCheckBox *checkBoxCalqueVisible;

    QToolButton* buttonNewCalque;
    QAction* actionNewCalque;

    QToolButton* buttonDeleteCalque;
    QAction* actionDeleteCalque;

    QToolButton* buttonFusionCalque;
    QAction* actionFusionCalque;
    QMenu* menuFusion;
    QAction * actionFusionUnion;
    QAction * actionFusionAdapte;

    QAction * actionFusionIntersection;
    QGridLayout* layoutDockCalques;
    QGridLayout* layoutOpacite;
    QGridLayout* layoutCalque;
    QGridLayout* layoutCalqueOption;

    QGroupBox *groupBoxOpacite;
    QGroupBox *groupBoxCalqueOption;

    QScrollArea *scrollAreaCalque;
    QVBoxLayout *layoutZoneCalque;
    QWidget *zoneCalque;


    void setupUi(QWidget *CalqueCreation)
    {
        if (CalqueCreation->objectName().isEmpty())
            CalqueCreation->setObjectName(QString::fromUtf8("CalqueCreation"));

        /************************  Opacite ***********************/
        spinBoxOpacite = new QSpinBox;
        spinBoxOpacite->setRange(0, 100);
        spinBoxOpacite->setSingleStep(1);
        spinBoxOpacite->setValue(100);

        sliderOpacite = new QSlider(CalqueCreation);
        sliderOpacite->setObjectName(QString::fromUtf8("sliderOpacite"));
        sliderOpacite->setGeometry(QRect(10, 40, 160, 17));
        sliderOpacite->setOrientation(Qt::Horizontal);
        sliderOpacite->setValue(100);
        sliderOpacite->setRange(0,100);
        sliderOpacite->setSingleStep(1);

        // The layout of the Opacite
        layoutOpacite = new QGridLayout();
        layoutOpacite->cellRect(1, 2);
        layoutOpacite->setObjectName(QString::fromUtf8("layoutOpacite"));
        layoutOpacite->addWidget(spinBoxOpacite, 0, 0, Qt::AlignTop);
        layoutOpacite->addWidget(sliderOpacite, 0, 1, Qt::AlignTop);
        // The group box of Opacite
        groupBoxOpacite = new QGroupBox("Opacite");
        groupBoxOpacite->setLayout(layoutOpacite);

        /************************  Calque ***********************/
        scrollAreaCalque = new QScrollArea;
        scrollAreaCalque->setWidgetResizable(true);
        scrollAreaCalque->setMinimumSize(200,200);
        scrollAreaCalque->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
        zoneCalque = new QWidget(scrollAreaCalque);
        layoutZoneCalque = new QVBoxLayout(zoneCalque);
        scrollAreaCalque->setWidget(zoneCalque);

        /************************  Options ***********************/
        // The option NewCalque
        buttonNewCalque = new QToolButton();
        buttonNewCalque->setText(QString("Ajouter"));
        buttonNewCalque->setObjectName(QString::fromUtf8("buttonNewCalque"));
        actionNewCalque = new QAction(QIcon("./image/add.png"),QString::fromUtf8("Ajout calque"),buttonNewCalque);
        actionNewCalque->setObjectName(QString::fromUtf8("actionNewCalque"));
        buttonNewCalque->setDefaultAction(actionNewCalque);
        actionNewCalque->setEnabled(false);

        // The option DeleteCalque
        buttonDeleteCalque = new QToolButton();
        buttonDeleteCalque->setText(QString("Supprimer"));
        buttonDeleteCalque->setObjectName(QString::fromUtf8("buttonDeleteCalque"));
        actionDeleteCalque = new QAction(QIcon("./image/delete.png"),QString::fromUtf8("Supprimer"), buttonDeleteCalque);
        actionDeleteCalque->setObjectName(QString::fromUtf8("actionDeleteCalque"));
        buttonDeleteCalque->setDefaultAction(actionDeleteCalque);
        actionDeleteCalque->setEnabled(false);

        // The option FusionCalque
        buttonFusionCalque = new QToolButton();
        buttonFusionCalque->setText(QString("Fusionner"));
        buttonFusionCalque->setObjectName(QString::fromUtf8("buttonFusionCalque"));
        actionFusionCalque = new QAction(QIcon("./image/fusion.png"),QString::fromUtf8("Fusionner"), buttonFusionCalque);
        actionFusionCalque->setObjectName(QString::fromUtf8("actionFusionCalque"));
        buttonFusionCalque->setDefaultAction(actionFusionCalque);
        actionFusionCalque->setEnabled(false);

        menuFusion = new QMenu(buttonFusionCalque);

        actionFusionUnion = new QAction(menuFusion);
        actionFusionUnion->setObjectName(QString::fromUtf8("actionFusionUnion"));
        actionFusionUnion->setStatusTip("actionFusionUnion");
        actionFusionUnion->setText("Union");

        actionFusionAdapte = new QAction(menuFusion);
        actionFusionAdapte->setObjectName(QString::fromUtf8("actionFusionAdapte"));
        actionFusionAdapte->setStatusTip("actionFusionAdapte");
        actionFusionAdapte->setText(QString::fromUtf8("Adapté"));

        actionFusionIntersection = new QAction(menuFusion);
        actionFusionIntersection->setObjectName(QString::fromUtf8("actionFusionIntersection"));
        actionFusionIntersection->setStatusTip("actionFusionIntersection");
        actionFusionIntersection->setText(QString::fromUtf8("Intersection"));

        menuFusion->addAction(actionFusionUnion);
        menuFusion->addAction(actionFusionAdapte);
        menuFusion->addAction(actionFusionIntersection);

        buttonFusionCalque->setPopupMode(QToolButton::MenuButtonPopup);
        buttonFusionCalque->setMenu(menuFusion);

        // The layout of the CalqueOption
        layoutCalqueOption = new QGridLayout();
        layoutCalqueOption->cellRect(3, 1);
        layoutCalqueOption->setObjectName(QString::fromUtf8("layoutCalqueOption"));
        layoutCalqueOption->addWidget(buttonNewCalque, 0, 0, Qt::AlignTop);
        layoutCalqueOption->addWidget(buttonDeleteCalque, 0, 1, Qt::AlignTop);
        layoutCalqueOption->addWidget(buttonFusionCalque, 0, 2, Qt::AlignTop);

        // The group box of CalqueOption
        groupBoxCalqueOption = new QGroupBox("Options");
        groupBoxCalqueOption->setLayout(layoutCalqueOption);

        /************************  dockCalque ***********************/
        // The layout of the dockCalque
        layoutDockCalques = new QGridLayout();
        layoutDockCalques->cellRect(3, 1);
        layoutDockCalques->setObjectName(QString::fromUtf8("layoutDockCalques"));
        layoutDockCalques->addWidget(groupBoxOpacite, 0, 0, Qt::AlignHCenter);
        layoutDockCalques->addWidget(scrollAreaCalque, 1, 0, Qt::AlignHCenter);
        layoutDockCalques->addWidget(groupBoxCalqueOption, 2, 0, Qt::AlignHCenter);

        CalqueCreation->setLayout(layoutDockCalques);


        QMetaObject::connectSlotsByName(CalqueCreation);
    } // setupUi

    void createNewMiniCalqueGraphisme(QWidget *objectInZoneCalque)
    {
        labelCalque = new QLabel();
        labelCalque->setFrameShape(QFrame::Box);
        labelCalque->setMaximumSize(40,30);

        labelTitreCalque = new QLabel();
        QString style = " QLabel {background:white;font-family: Times;font: 10px;}";
        labelTitreCalque->setStyleSheet(style);

        checkBoxCalqueVisible = new QCheckBox();
        checkBoxCalqueVisible->setMaximumSize(20,20);

        // The layout of the Calque
        layoutCalque = new QGridLayout();
        layoutCalque->cellRect(3,2);
        layoutCalque->addWidget(labelCalque, 0, 0, Qt::AlignTop);
        layoutCalque->addWidget(labelTitreCalque, 0, 1, Qt::AlignTop);
        layoutCalque->addWidget(checkBoxCalqueVisible, 0, 2, Qt::AlignTop);

        objectInZoneCalque->setLayout(layoutCalque);

        layoutZoneCalque->addWidget(objectInZoneCalque);
    }

    // This method delete the scrollBarArea and recreate it
    void razCalqueGraphisme()
    {
        delete scrollAreaCalque;

        scrollAreaCalque = new QScrollArea;
        scrollAreaCalque->setWidgetResizable(true);
        scrollAreaCalque->setMinimumSize(200,200);
        scrollAreaCalque->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
        zoneCalque = new QWidget(scrollAreaCalque);
        layoutZoneCalque = new QVBoxLayout(zoneCalque);
        scrollAreaCalque->setWidget(zoneCalque);
        layoutDockCalques->addWidget(scrollAreaCalque, 1, 0, Qt::AlignHCenter);
    }
};

namespace UiCalques {
    class CalquesClass: public Ui_Calques {};
}

QT_END_NAMESPACE

#endif // UI_CALQUE_H
